﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MTGenome.Core.Import
{
    public class UrlBuilder
    {
        private const string SearchUrl = "http://gatherer.wizards.com/Pages/Search/Default.aspx?";
        private const string DetailsUrl = "http://gatherer.wizards.com/Pages/Card/Details.aspx?";
        private readonly StringBuilder _builder = new StringBuilder();

        public UrlBuilder Search()
        {
            _builder.Append(SearchUrl);
            return this;
        }

        public UrlBuilder Details()
        {
            _builder.Append(DetailsUrl);
            return this;
        }

        public UrlBuilder Output(OutputType type)
        {
            _builder.Append("&output=");
            _builder.Append(type.ToString().ToLower());
            return this;
        }

        public UrlBuilder Method(MethodType type)
        {
            _builder.Append("&method=");
            _builder.Append(type.ToString().ToLower());
            return this;
        }

        public UrlBuilder MultiverseID(int id)
        {
            _builder.Append("&multiverseid=");
            _builder.Append(id);
            return this;
        }

        public override string ToString()
        {
            return _builder.ToString();
        }
    }
}
